from django.db import models

# Create your models here.
# 前台用户登陆账号密码等信息
class CustomLogin(models.Model):
    Status_choices = (
        ('1','正常'),
        ('2','封号')
    )
    GENDER_CHOICES = (
        ('1', '男'),
        ('2', '女'),
    )
    username = models.CharField(max_length=20,verbose_name='登陆用户名',null=True)
    password = models.CharField(max_length=20,verbose_name='登陆密码',null=True)
    name = models.CharField(max_length=10,verbose_name='姓名',null=True)
    avatar = models.URLField(verbose_name='存放图片地址', blank=True,null=True)
    mobile = models.CharField(max_length=13, blank=True, null=True,verbose_name='手机号')
    gender = models.CharField(max_length=1,verbose_name='性别', choices=GENDER_CHOICES, blank=True, null=True)
    created_time = models.DateTimeField(auto_now_add=True,verbose_name='建立账号时间')
    status = models.CharField(max_length=1,choices=Status_choices,null=True)
    description = models.CharField(max_length=1000,null=True,verbose_name='个人简介')
    class Meta:
        db_table = "netshop_custom"


class Address(models.Model):
    id = models.AutoField(primary_key=True)
    custom_id = models.CharField(max_length=10,null=True)
    name = models.CharField(verbose_name='收件人',null=True,max_length=100)
    mobile = models.CharField(max_length=30,verbose_name='手机号',null=True)
    adpca = models.CharField(max_length=20,null=True,verbose_name='省市')
    province = models.CharField(max_length=20,null=True,verbose_name='省')
    city = models.CharField(max_length=20, null=True, verbose_name='市')
    region = models.CharField(max_length=20, null=True, verbose_name='区')
    detail = models.CharField(max_length=50,null=True,verbose_name='详细地址')
    is_default = models.BooleanField(default=False,verbose_name='是否为默认',null=True)
    class Meta:
        db_table = 'address'

class Order(models.Model):
    status_choices = (
        ('0', '未支付'),
        ('1', '已支付'),
        ('2', '已取消'),
        ('3', '超时取消'),
    )
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=10,null=True,verbose_name='收件人')
    address = models.CharField(max_length=20,verbose_name='省区地址',null=True)
    province = models.CharField(max_length=20, null=True, verbose_name='省')
    city = models.CharField(max_length=20, null=True, verbose_name='市')
    region = models.CharField(max_length=20, null=True, verbose_name='区')
    detail = models.CharField(max_length=200,verbose_name='详细地址',null=True)
    mobile = models.CharField(max_length=20,verbose_name='联系电话',null=True)
    shop_id = models.IntegerField(verbose_name='订单所在数据库的Id',null=True)
    custom_id = models.CharField(max_length=20,verbose_name='执行者的id',null=True)
    order_id = models.CharField(max_length=20,verbose_name='订单编号',null=True)
    kind = models.CharField(max_length=20,verbose_name='商品种类',null=True)
    order_time = models.DateTimeField(auto_now_add=True,verbose_name='订单创建时间',null=True)
    shop_name = models.CharField(verbose_name='购买的商品',null=True,max_length=10)
    picture_url = models.URLField(verbose_name='存放图片地址', blank=True,null=True)
    totalprice = models.IntegerField(verbose_name='总计金额',null=True)
    quantity = models.IntegerField(verbose_name='数量',null=True)
    buy_status = models.CharField(verbose_name='支付状态',choices=status_choices,null=True,max_length=10)
    class Meta:
        db_table = 'orderview'





